Skip to content

OCPBUGS-95069: agent/waitfor: verify expected nodes before declaring install complete#10711

Open
savio87 wants to merge 4 commits into
openshift:mainfrom
savio87:OCPBUGS-95069
Open

OCPBUGS-95069: agent/waitfor: verify expected nodes before declaring install complete#10711
savio87 wants to merge 4 commits into
openshift:mainfrom
savio87:OCPBUGS-95069

Conversation

@savio87

@savio87 savio87 commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • Adds node verification to agent wait-for install-complete to prevent false success when expected nodes are missing
  • After operator stability checks pass, queries Kubernetes for actual Node objects and verifies the expected number of master and worker nodes are present and Ready
  • Reads expected node counts from the install-config controlPlane.replicas and compute[].replicas

Fixes https://issues.redhat.com/browse/OCPBUGS-95069

Details

The wait-for install-complete command currently only checks ClusterVersion conditions and operator stability. As reported in OCPBUGS-95069, these conditions can transiently be satisfied even when a node (e.g. master-0) was never created, causing the command to falsely report success.

This change follows the same pattern used for FIPS verification (PR #10348) - adding a verification step in WaitForInstallComplete and wiring the expected values from the agent CLI.

Test plan

Summary by CodeRabbit

  • New Features
    • Installation completion now verifies expected master- and worker-role Nodes exist and reach Ready=True, using counts derived from the install configuration.
    • The verification is skipped when both expected counts are zero, and it runs after existing FIPS verification when enabled.
  • Tests
    • Added unit tests to validate extraction of expected master/worker node counts from the install configuration.
    • Added unit tests to confirm node readiness verification behavior using simulated Kubernetes Nodes.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@savio87: This pull request references Jira Issue OCPBUGS-95069, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Adds node verification to agent wait-for install-complete to prevent false success when expected nodes are missing
  • After operator stability checks pass, queries Kubernetes for actual Node objects and verifies the expected number of master and worker nodes are present and Ready
  • Reads expected node counts from the install-config controlPlane.replicas and compute[].replicas

Fixes https://issues.redhat.com/browse/OCPBUGS-95069

Details

The wait-for install-complete command currently only checks ClusterVersion conditions and operator stability. As reported in OCPBUGS-95069, these conditions can transiently be satisfied even when a node (e.g. master-0) was never created, causing the command to falsely report success.

This change follows the same pattern used for FIPS verification (PR #10348) - adding a verification step in WaitForInstallComplete and wiring the expected values from the agent CLI.

Test plan

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e3fe0b7-dd85-4844-9f06-f89ef80378bf

📥 Commits

Reviewing files that changed from the base of the PR and between f03ff97 and 2341128.

📒 Files selected for processing (1)
  • cmd/openshift-install/command/waitfor_node_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/openshift-install/command/waitfor_node_test.go

📝 Walkthrough

Walkthrough

The install-complete command derives expected master and worker counts from install-config and verifies that corresponding role-labeled Kubernetes nodes are Ready before completion.

Changes

Install completion node readiness

Layer / File(s) Summary
Expected node count wiring
cmd/openshift-install/agent/waitfor.go, cmd/openshift-install/agent/waitfor_test.go, cmd/openshift-install/command/waitfor.go
Control-plane and compute replica counts are extracted, tested, and passed through WaitOptions.
Ready node verification
cmd/openshift-install/command/waitfor.go, cmd/openshift-install/command/waitfor_node_test.go
Completion lists master- and worker-labeled nodes, counts NodeReady=True conditions, and tests missing or not-ready node cases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding node verification before install-complete succeeds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The added tests use static, descriptive names only; no Ginkgo titles or dynamic identifiers appear in test names.
Test Structure And Quality ✅ Passed PASS: These are table-driven unit tests, not Ginkgo, and they use fake clients with per-scenario subtests, clear error messages, and no cluster waits/resources.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the new tests are unit tests using fake client-go and corev1 Nodes, with no unsupported MicroShift APIs or assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests were added; the new tests are plain Go unit tests, so the SNO-specific check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed No scheduling constraints were added; verification is gated by install-config counts and skips zero-worker topologies before checking Ready nodes.
Ote Binary Stdout Contract ✅ Passed Touched files add node-verification logic and tests only; no new stdout writes appear in main/init/TestMain or top-level initializers, and main.go already silences klog.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo/e2e tests were added; the PR adds plain Go unit tests and no IPv4-only literals or external connectivity requirements.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons appear in the changed code; the patch only adds node-verification logic and tests.
Container-Privileges ✅ Passed No changed files introduce privileged/host* settings or allowPrivilegeEscalation; the diff only adds node-verification logic and tests.
No-Sensitive-Data-In-Logs ✅ Passed New logs are generic status/counts only; no added code prints secrets, PII, hostnames, or node details. The install-config warning logs only the error.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@savio87: This pull request references Jira Issue OCPBUGS-95069, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • Adds node verification to agent wait-for install-complete to prevent false success when expected nodes are missing
  • After operator stability checks pass, queries Kubernetes for actual Node objects and verifies the expected number of master and worker nodes are present and Ready
  • Reads expected node counts from the install-config controlPlane.replicas and compute[].replicas

Fixes https://issues.redhat.com/browse/OCPBUGS-95069

Details

The wait-for install-complete command currently only checks ClusterVersion conditions and operator stability. As reported in OCPBUGS-95069, these conditions can transiently be satisfied even when a node (e.g. master-0) was never created, causing the command to falsely report success.

This change follows the same pattern used for FIPS verification (PR #10348) - adding a verification step in WaitForInstallComplete and wiring the expected values from the agent CLI.

Test plan

Summary by CodeRabbit

  • New Features
  • Installation completion checks now verify that the expected number of master and worker nodes are present and Ready.
  • Expected node counts are derived automatically from the installation configuration.
  • Installation waits now report an error when required Ready nodes are missing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Hi @savio87. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign rwsu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
openshift-ci Bot requested review from andfasano and rna-afk July 24, 2026 10:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/openshift-install/command/waitfor.go`:
- Around line 121-183: Add unit tests for
cmd/openshift-install/command/waitfor.go lines 121-183 covering Ready and
NotReady role-labeled nodes, missing master/worker counts, zero expectations,
and error paths for client or node listing; add unit tests for
cmd/openshift-install/agent/waitfor.go lines 128-147 covering expected
master/worker derivation from optional install-config, including control-plane
and multiple compute-pool replicas. Use the existing test conventions and fake
Kubernetes/config clients where applicable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: ec9ec5cb-9744-4847-a7a3-25686bdf2517

📥 Commits

Reviewing files that changed from the base of the PR and between d8f6a96 and 62417fd.

📒 Files selected for processing (2)
  • cmd/openshift-install/agent/waitfor.go
  • cmd/openshift-install/command/waitfor.go

Comment thread cmd/openshift-install/command/waitfor.go
@savio87

savio87 commented Jul 24, 2026

Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cmd/openshift-install/command/waitfor_node_test.go (1)

70-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the worker-not-Ready branch.

Add a case with two worker nodes where one is NodeReady=False; currently only the master readiness loop is directly tested for that condition.

Proposed test case
+		{
+			name:            "worker node not ready",
+			nodes:           []*corev1.Node{newNode("worker-0", "worker", true), newNode("worker-1", "worker", false)},
+			expectedWorkers: 2,
+			expectErr:       true,
+			errContains:     "expected 2 worker node(s) to be Ready but only 1 found",
+		},

As per path instructions, “Verify edge cases are covered, especially for validation and defaulting logic.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/openshift-install/command/waitfor_node_test.go` around lines 70 - 83, Add
a wait-for-node test case alongside the existing worker cases with two worker
nodes, one Ready and one NodeReady=False, and assert the expected error for an
insufficient number of Ready workers. Use the existing node-construction helper
and readiness assertions in the test to cover the worker-not-Ready branch.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cmd/openshift-install/command/waitfor_node_test.go`:
- Around line 70-83: Add a wait-for-node test case alongside the existing worker
cases with two worker nodes, one Ready and one NodeReady=False, and assert the
expected error for an insufficient number of Ready workers. Use the existing
node-construction helper and readiness assertions in the test to cover the
worker-not-Ready branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 25e40e88-ac89-40de-bae3-bcd4c5f958a4

📥 Commits

Reviewing files that changed from the base of the PR and between 62417fd and 9cfa602.

📒 Files selected for processing (4)
  • cmd/openshift-install/agent/waitfor.go
  • cmd/openshift-install/agent/waitfor_test.go
  • cmd/openshift-install/command/waitfor.go
  • cmd/openshift-install/command/waitfor_node_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/openshift-install/agent/waitfor.go
  • cmd/openshift-install/command/waitfor.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/openshift-install/agent/waitfor.go`:
- Around line 130-136: Handle errors from assetStore.Load in the install-config
loading flow before processing installConfigAsset: propagate or terminate on
non-optional load failures rather than silently leaving expectedMasters and
expectedWorkers at zero. Preserve the existing optional-config behavior when no
asset is available, and keep the FIPS and extractExpectedNodeCounts handling for
successfully loaded configs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: a2dd3216-d0db-42f2-85a9-b1ce3c5aba8a

📥 Commits

Reviewing files that changed from the base of the PR and between d8f6a96 and 9cfa602.

📒 Files selected for processing (4)
  • cmd/openshift-install/agent/waitfor.go
  • cmd/openshift-install/agent/waitfor_test.go
  • cmd/openshift-install/command/waitfor.go
  • cmd/openshift-install/command/waitfor_node_test.go

Comment thread cmd/openshift-install/agent/waitfor.go Outdated
Comment on lines 130 to 136
if installConfigAsset, err := assetStore.Load(&agentasset.OptionalInstallConfig{}); err == nil && installConfigAsset != nil {
ic := installConfigAsset.(*agentasset.OptionalInstallConfig)
if ic.Config != nil {
fipsEnabled = ic.Config.FIPS
expectedMasters, expectedWorkers = extractExpectedNodeCounts(ic.Config)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not silently disable node verification on install-config load failures.

Line 130 ignores every Load error, leaving both counts at zero; verifyExpectedNodes then skips validation. Return or terminate on non-optional load errors instead of treating them as an absent config. As per path instructions, “Never ignore error returns.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/openshift-install/agent/waitfor.go` around lines 130 - 136, Handle errors
from assetStore.Load in the install-config loading flow before processing
installConfigAsset: propagate or terminate on non-optional load failures rather
than silently leaving expectedMasters and expectedWorkers at zero. Preserve the
existing optional-config behavior when no asset is available, and keep the FIPS
and extractExpectedNodeCounts handling for successfully loaded configs.

Source: Path instructions

Log a warning instead of silently skipping FIPS and node
verification when the install-config cannot be loaded.

Co-authored-by: Cursor <cursoragent@cursor.com>
@savio87

savio87 commented Jul 24, 2026

Copy link
Copy Markdown
Author

coderabbitai full review

Cover the branch where a worker node exists but has
NodeReady=False, mirroring the existing master-not-ready test.

Co-authored-by: Cursor <cursoragent@cursor.com>
@patrickdillon

Copy link
Copy Markdown
Contributor

We already have checks in place that should have caught this issue. I think it would be better to improve those checks, rather than making more specific checks for each case, particularly as the more general checks will help with upgrades as well as installs.

@savio87

savio87 commented Jul 27, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback, @patrickdillon. I agree that improving the existing general checks would be the better long-term fix -- especially since that would cover upgrades as well as installs. Could you point me to which specific checks you think should be improved? For example, should waitForStableOperators() also verify that operators are not Degraded (not just not Progressing)?

That said, I think there may still be value in a node readiness check as a complementary safety net. The general checks rely on operators accurately reporting their status, but as Zane Bitter noted on the Jira issue, there was a ~10-minute window where etcd reported Progressing=False before transitioning to Degraded=True. A direct node count verification would catch the "missing node" case regardless of operator reporting gaps.

Happy to take whichever direction you think is best -- whether that's improving the existing checks, keeping this as a complementary safeguard, or both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants